package cn.scy.business.controller;

import cn.scy.base.PageResult;
import cn.scy.base.ResponseDTO;
import cn.scy.business.domain.entity.NumMemberInfo;
import cn.scy.business.domain.param.NumMemberInfoParam;
import cn.scy.business.service.NumMemberInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 报备管理-号码身份表 前端控制器
 *
 * @author scy
 * @since 2025-04-26
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/num/member")
public class NumMemberInfoController {

    private final NumMemberInfoService memberInfoService;

    @GetMapping("listPage")
    public ResponseDTO<PageResult<NumMemberInfo>> listPage(NumMemberInfoParam param) {
        return ResponseDTO.ok(memberInfoService.listPage(param));
    }

    @GetMapping("info")
    public ResponseDTO<NumMemberInfo> info(@RequestParam("id") String id) {
        return ResponseDTO.ok(memberInfoService.info(id));
    }

    @PostMapping("add")
    public ResponseDTO<Boolean> addMember(@RequestBody NumMemberInfo numMemberInfo) {
        return ResponseDTO.ok(memberInfoService.addMember(numMemberInfo));
    }

    @PostMapping("edit")
    public ResponseDTO<Boolean> editMember(@RequestBody NumMemberInfo numMemberInfo) {
        return ResponseDTO.ok(memberInfoService.editMember(numMemberInfo));
    }

    @PostMapping("delete")
    public ResponseDTO<Boolean> deleteMember(@RequestParam("id") String id) {
        return ResponseDTO.ok(memberInfoService.deleteMember(id));
    }

}
